package dao;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import util.ConnectionUtil;

public class ClassDao {
	public static int getClassId(String string) {
		// 根据班级名称查询班级的编号
		Connection conn = ConnectionUtil.getConnection();
		String sql = "SELECT ClassID FROM class where classname like '%" + string + "%'";
		Statement stat;
		try {
			stat = conn.createStatement();
			ResultSet rs = stat.executeQuery(sql);
			if (rs.next()) {
				int class_id = rs.getInt("classid");
				return class_id;
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}

		return 1701;
	}
}
